import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;

/**
 * Created by FCMMY on 2017/4/25.
 */
public class SiteJsps {
    private static String siteJspsFile = "D:\\项目\\25安徽某证券公司代码审计\\siteJsps.txt";

    public static Set<String> getJsps() {
        String siteJspsStr = readFileByLines(siteJspsFile);
        System.out.println(siteJspsStr);
        String[] jsps = siteJspsStr.split(",");
        Set<String> jspSet = new HashSet<>();
        for (int i = 0; i < jsps.length; i++) {
            jspSet.add(jsps[i]);
        }
        return jspSet;
    }

    public static String readFileByLines(String fileName) {
        File file = new File(fileName);
        BufferedReader reader = null;
        String readString = "";
        try {
            reader = new BufferedReader(new FileReader(file));
            String tempString = null;
            while ((tempString = reader.readLine()) != null) {
                readString += tempString + ",";
            }
            reader.close();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (reader != null) {
                try {
                    reader.close();
                } catch (IOException e1) {
                }
            }
        }
        return readString;
    }
}
